/**
 * 
 */
package com.angel.configuration.initializer.impl;

import com.angel.architecture.persistence.beans.ConfigurationParameter;
import com.angel.common.helpers.ReflectionHelper;
import com.angel.configuration.initializer.ConfigurationInitializer;
import com.angel.io.processors.commands.exports.ExportRowProcessorCommand;
import com.angel.webapp.application.ApplicationExportRowCommands;

/**
 * @author William
 *
 */
public class ExportRowStrategiesInitializer extends ConfigurationInitializer{

	private static final String ROW_STRATEGIES_AREA_NAME = "ExportRowsStrategies";

	@Override
	public boolean appliesConfiguration(ConfigurationParameter cp) {
		return cp != null && cp.isForParameterArea(ROW_STRATEGIES_AREA_NAME);
	}
	
	@Override
	public void addConfiguration(ConfigurationParameter cp) {
		ExportRowProcessorCommand exportRowProcessorCommand= (ExportRowProcessorCommand) ReflectionHelper.createObject(cp.getStringValue());
		ApplicationExportRowCommands.createInstance().addExportRowCommand(cp.getName(), exportRowProcessorCommand);
	}

}
